<template>
<div class="reply_form">
  <el-form label-width="80px" label-position="left">
    <el-form-item label="昵称">
      <el-input v-model="nickname" />
    </el-form-item>
    <el-form-item label="邮箱">
      <el-input v-model="email" />
    </el-form-item>
    <el-form-item label="评论内容">
      <el-input type="textarea" rows="5" v-model="content" />
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="submit">提交</el-button>
      <div class="tips">* 为了保证评论的合法合规，您的评论将会在发布后进入审核状态</div>
    </el-form-item>
  </el-form>
</div>
</template>

<script setup>
import {ref} from "vue";
import {ElMessage} from "element-plus";

const nickname = ref('');
const email = ref('');
const content = ref('');

const emit = defineEmits(['submit'])

const submit = async () => {
  if (nickname.value === '' || email.value === '' || content.value === '') {
    ElMessage.error("请填写完整信息!")
    return
  }
  let res = {
    nickname, email, content
  }
  emit('submit', res)
}
</script>

<style scoped>
.reply_form {
  padding: 10px 0;
}

.tips {
  color: #999999;
}
</style>